home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / mail / metamail / drafts / RFC-ENRICHED.txt.Z / RFC-ENRICHED.txt
Encoding:
Text File  |  1993-12-30  |  38.9 KB  |  987 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.             Network Working Group                         N. Borenstein
  8.             Request for Comments: 1563                         Bellcore
  9.             Obsoletes: 1523                                January 1994
  10.             Category: Informational
  11.  
  12.  
  13.                         The text/enriched MIME Content-type
  14.  
  15.  
  16.             Status of this Memo
  17.  
  18.             This memo provides information for the  Internet  community.
  19.             This memo does not specify an Internet standard of any kind.
  20.             Distribution of this memo is unlimited.
  21.  
  22.             Abstract
  23.  
  24.             MIME [RFC-1341,  RFC-1521]  defines  a  format  and  general
  25.             framework  for  the representation of a wide variety of data
  26.             types  in  Internet  mail.   This   document   defines   one
  27.             particular  type  of  MIME  data,  the text/enriched type, a
  28.             refinement of the "text/richtext" type defined in RFC  1341.
  29.             The  text/enriched  MIME  type is intended to facilitate the
  30.             wider interoperation of simple enriched text across  a  wide
  31.             variety of hardware and software platforms.
  32.  
  33.             The Text/enriched MIME type
  34.  
  35.             In order to promote the  wider  interoperability  of  simple
  36.             formatted  text,  this  document defines an extremely simple
  37.             subtype of the MIME content-type "text", the "text/enriched"
  38.             subtype.   This  subtype  was designed to meet the following
  39.             criteria:
  40.  
  41.                  1.  The syntax must be extremely simple to  parse,
  42.                  so  that  even  teletype-oriented mail systems can
  43.                  easily strip away the formatting  information  and
  44.                  leave only the readable text.
  45.  
  46.                  2.  The syntax must be extensible to allow for new
  47.                  formatting  commands that are deemed essential for
  48.                  some application.
  49.  
  50.                  3.  If the character set in use is ASCII or an  8-
  51.                  bit  ASCII superset, then the raw form of the data
  52.                  must   be   readable   enough   to   be    largely
  53.  
  54.  
  55.  
  56.             Borenstein                                          [Page 1]
  57.  
  58.  
  59.  
  60.  
  61.  
  62.             RFC 1563       A text/enriched type for MIME    January 1994
  63.  
  64.  
  65.                  unobjectionable  in the event that it is displayed
  66.                  on the screen of the user of a non-MIME-conformant
  67.                  mail reader.
  68.  
  69.                  4.  The capabilities must be extremely limited, to
  70.                  ensure  that  it  can  represent  no  more than is
  71.                  likely to be representable by the  user's  primary
  72.                  word  processor.   While  this  limits what can be
  73.                  sent, it increases the  likelihood  that  what  is
  74.                  sent can be properly displayed.
  75.  
  76.             This   document   defines   a   new    MIME    content-type,
  77.             "text/enriched".   The  content-type  line for this type may
  78.             have one optional parameter, the "charset"  parameter,  with
  79.             the   same   values  permitted  for  the  "text/plain"  MIME
  80.             content-type.
  81.  
  82.             The syntax of "text/enriched" is very simple.  It represents
  83.             text  in  a  single  character  set  -- US-ASCII by default,
  84.             although a different character set can be specified  by  the
  85.             use   of   the   "charset"  parameter.   (The  semantics  of
  86.             text/enriched in  non-ASCII  character  sets  are  discussed
  87.             later   in   this   document.)    All  characters  represent
  88.             themselves, with the exception of the "<"  character  (ASCII
  89.             60),  which  is  used  to mark the beginning of a formatting
  90.             command.   Formatting  instructions  consist  of  formatting
  91.             commands   surrounded  by angle brackets ("<>", ASCII 60 and
  92.             62).  Each  formatting  command  may  be  no  more  than  60
  93.             characters  in  length,  all  in US-ASCII, restricted to the
  94.             alphanumeric  and  hyphen  ("-")   characters.    Formatting
  95.             commands  may  be  preceded  by  a  solidus ("/", ASCII 47),
  96.             making them negations, and such negations must always  exist
  97.             to  balance  the  initial  opening  commands.   Thus, if the
  98.             formatting command "<bold>" appears  at  some  point,  there
  99.             must  later  be  a  "</bold>" to balance it.  (NOTE:  The 60
  100.             character limit on formatting commands does NOT include  the
  101.             "<",  ">",  or "/" characters that might be attached to such
  102.             commands.)
  103.  
  104.             Formatting commands are always case-insensitive.   That  is,
  105.             "bold"  and  "BoLd" are equivalent in effect, if not in good
  106.             taste.
  107.  
  108.             Beyond tokens delimited by "<" and ">", there are two  other
  109.             special  processing  rules.  First, a literal less-than sign
  110.             ("<")  can  be  represented  by  a  sequence  of  two   such
  111.  
  112.  
  113.  
  114.             Borenstein                                          [Page 2]
  115.  
  116.  
  117.  
  118.  
  119.  
  120.             RFC 1563       A text/enriched type for MIME    January 1994
  121.  
  122.  
  123.             characters,  "<<".    Second,  line  breaks  (CRLF  pairs in
  124.             standard network representation) are handled specially.   In
  125.             particular, isolated CRLF pairs are translated into a single
  126.             SPACE character.  Sequences of  N  consecutive  CRLF  pairs,
  127.             however,  are  translated into N-1 actual line breaks.  This
  128.             permits long lines of data to be represented in  a  natural-
  129.             looking  manner  despite  the  frequency of line-wrapping in
  130.             Internet  mailers.   When  preparing  the  data   for   mail
  131.             transport,  isolated line breaks should be inserted wherever
  132.             necessary to keep each  line  shorter  than  80  characters.
  133.             When  preparing  such  data  for  presentation  to the user,
  134.             isolated line breaks should be replaced by  a  single  SPACE
  135.             character,  and N consecutive CRLF pairs should be presented
  136.             to the user as N-1 line breaks.
  137.  
  138.             Thus text/enriched data that looks like this:
  139.                  This is
  140.                  a single
  141.                  line
  142.  
  143.                  This is the
  144.                  next line.
  145.  
  146.  
  147.                  This is the
  148.                  next paragraph.
  149.  
  150.             should  be  displayed  by  a  text/enriched  interpreter  as
  151.             follows:
  152.  
  153.                  This is a single line
  154.                  This is the next line.
  155.  
  156.                  This is the next paragraph.
  157.  
  158.             The  formatting  commands,  not  all  of   which   will   be
  159.             implemented  by  all  implementations,  are described in the
  160.             following sections.
  161.  
  162.             Formatting Commands
  163.  
  164.             The  text/enriched  formatting  commands  all   begin   with
  165.             <commandname>  and  end  with </commandname>,  affecting the
  166.             formatting of  the  text  between  those  two  tokens.   The
  167.             commands are described here, grouped according to type.
  168.  
  169.  
  170.  
  171.  
  172.             Borenstein                                          [Page 3]
  173.  
  174.  
  175.  
  176.  
  177.  
  178.             RFC 1563       A text/enriched type for MIME    January 1994
  179.  
  180.  
  181.             Font-Alteration Commands
  182.  
  183.             The following formatting commands are intended to alter  the
  184.             font  in  which  text  is  displayed,  but  not to alter the
  185.             indentation or justification state of the text:
  186.  
  187.                  Bold -- causes the affected text to be in a bold  font.
  188.                       Nested  bold  commands  have  the same effect as a
  189.                       single bold command.
  190.                  Italic -- causes the affected text to be in  an  italic
  191.                       font.  Nested italic commands have the same effect
  192.                       as a single italic command.
  193.                  Fixed -- causes the affected text  to  be  in  a  fixed
  194.                       width  font.   Nested fixed commands have the same
  195.                       effect as a single fixed command.
  196.                  Smaller -- causes the affected text to be in a  smaller
  197.                       font.   It  is  recommended  that the font size be
  198.                       changed by two points, but other  amounts  may  be
  199.                       more  appropriate  in  some  environments.  Nested
  200.                       smaller commands produce  ever-smaller  fonts,  to
  201.                       the  limits  of  the  implementation's capacity to
  202.                       reasonably  display  them,  after  which   further
  203.                       smaller commands have no incremental effect.
  204.                  Bigger -- causes the affected text to be  in  a  bigger
  205.                       font.   It  is  recommended  that the font size be
  206.                       changed by two points, but other  amounts  may  be
  207.                       more  appropriate  in  some  environments.  Nested
  208.                       bigger commands produce ever-bigger fonts, to  the
  209.                       limits   of   the   implementation's  capacity  to
  210.                       reasonably  display  them,  after  which   further
  211.                       bigger commands have no incremental effect.
  212.                  Underline -- causes the affected text to be underlined.
  213.                       Nested  underline commands have the same effect as
  214.                       a single underline command.
  215.  
  216.             While the "bigger" and "smaller" operators  are  effectively
  217.             inverses,   it   is   not  recommended,  for  example,  that
  218.             "<smaller>" be used  to end the effect of "<bigger>".   This
  219.             is properly done with "</bigger>".
  220.  
  221.             Fill/Justification Commands
  222.  
  223.             Initially, text/enriched text is intended  to  be  displayed
  224.             fully filled with appropriate kerning and letter-tracking as
  225.             suits the capabilities of the receiving user agent software.
  226.             Actual line width is left to the discretion of the receiver,
  227.  
  228.  
  229.  
  230.             Borenstein                                          [Page 4]
  231.  
  232.  
  233.  
  234.  
  235.  
  236.             RFC 1563       A text/enriched type for MIME    January 1994
  237.  
  238.  
  239.             which is expected to fold  lines  intelligently  (preferring
  240.             soft line breaks) to the best of its ability.
  241.  
  242.             The following commands alter  that  state.   Each  of  these
  243.             commands  force a line break before and after the formatting
  244.             environment if there is not otherwise  a  line  break.   For
  245.             example, if one of these commands occurs anywhere other than
  246.             the beginning of a line of text as presented, a new line  is
  247.             begun.
  248.  
  249.                  Center -- causes the affected text to be centered.
  250.                  FlushLeft -- causes  the  affected  text  to  be  left-
  251.                       justified with a ragged right margin.
  252.                  FlushRight -- causes the affected  text  to  be  right-
  253.                       justified with a ragged left margin.
  254.                  FlushBoth -- causes the affected text to be filled  and
  255.                       padded  so  as  to  create  smooth  left and right
  256.                       margins, i.e., to be fully justified.
  257.                  Nofill -- causes the  affected  text  to  be  displayed
  258.                       without filling or justification.
  259.  
  260.             The center, flushleft, flushright,  and  flushboth  commands
  261.             are  mutually exclusive, and, when nested, the inner command
  262.             takes precedence.
  263.  
  264.             Whether or not  text  is  justified  by  default  (that  is,
  265.             whether the default environment is flushleft, flushright, or
  266.             flushboth) is unspecified, and depends on the preferences of
  267.             the  user,  the  capabilities  of  the  local  software  and
  268.             hardware, and the nature of the character set  in  use.   On
  269.             systems  where  justification is considered undesirable, the
  270.             flushboth  environment  may  be  identical  to  the  default
  271.             environment.    Note  that  justification  should  never  be
  272.             performed inside of center, flushleft, flushright, or nofill
  273.             environments.   Note  also that for some non-ASCII character
  274.             sets, full justification may be fundamentally inappropriate.
  275.  
  276.             Indentation Commands
  277.  
  278.             Initially, text/enriched text is displayed using the maximum
  279.             available  margins.   Two formatting commands may be used to
  280.             affect the margins.
  281.  
  282.                  Indent -- causes the running left margin to be moved to
  283.                       the  right.  The recommended indentation change is
  284.                       the width of four characters, but this may  differ
  285.  
  286.  
  287.  
  288.             Borenstein                                          [Page 5]
  289.  
  290.  
  291.  
  292.  
  293.  
  294.             RFC 1563       A text/enriched type for MIME    January 1994
  295.  
  296.  
  297.                       among implementations.
  298.                  IndentRight -- causes the running right  margin  to  be
  299.                       moved  to  the  left.  The recommended indentation
  300.                       change is the width of four characters,  but  this
  301.                       may differ among implementations.
  302.  
  303.             A line break is NOT forced by a change  of  the  margin,  to
  304.             permit  the description of "hanging" text.  Thus for example
  305.             the following text:
  306.  
  307.             Now <indent> is the time for all good horses to come to  the
  308.             aid  of  their stable, assuming that </indent> any stable is
  309.             really stable.
  310.  
  311.             would be displayed in a 40-character-wide window as follows:
  312.  
  313.             Now is the time for all good horses to
  314.                 come to the aid of their stable,
  315.                 assuming that any stable is
  316.             really stable.
  317.  
  318.             Miscellaneous Commands
  319.  
  320.                  Excerpt -- causes the affected text to  be  interpreted
  321.                       as a textual excerpt from another source, probably
  322.                       a message being responded to.  Typically this will
  323.                       be  displayed  using  indentation and an alternate
  324.                       font, or by indenting  lines  and  preceding  them
  325.                       with  ">  ",  but  such  decisions  are  up to the
  326.                       implementation.  (Note that this is the only truly
  327.                       declarative markup construct in text/enriched, and
  328.                       as such doesn't  fit  very  well  with  the  other
  329.                       facilities, but it describes a type of markup that
  330.                       is  very  commonly  used  in  email  and  has   no
  331.                       procedural  analogue.)    Note  that  as  with the
  332.                       justification  commands,   the   excerpt   command
  333.                       implicitly  begins  and  ends with a line break if
  334.                       one is not already there.
  335.                  Param -- Marks the affected text as command parameters,
  336.                       to  be interpreted or ignored by the text/enriched
  337.                       interpreter, but NOT to be shown  to  the  reader.
  338.                       The syntax of the parameter data (whatever appears
  339.                       between the initial "<param>" and the  terminating
  340.                       "</param>")  is left undefined by this memo, to be
  341.                       defined by text/enriched extensions in the future.
  342.                       However,  the format of such data must NOT contain
  343.  
  344.  
  345.  
  346.             Borenstein                                          [Page 6]
  347.  
  348.  
  349.  
  350.  
  351.  
  352.             RFC 1563       A text/enriched type for MIME    January 1994
  353.  
  354.  
  355.                       nested <param> commands, and either must  NOT  use
  356.                       the  "<" character or must use it in a way that is
  357.                       compatible with text/enriched parsing.   That  is,
  358.                       the   end   of   the   parameter  data  should  be
  359.                       recognizable  with  EITHER  of   two   algorithms:
  360.                       simply   searching  for  the  first  occurence  of
  361.                       "</param>" or parsing until a balanced  "</param>"
  362.                       command  is  found.   In either case, however, the
  363.                       parameter data should NOT be shown  to  the  human
  364.                       reader.
  365.  
  366.             Balancing and Nesting of Formatting Commands
  367.  
  368.             Pairs of formatting commands must be properly  balanced  and
  369.             nested.  Thus, a proper way to describe text in bold italics
  370.             is:
  371.  
  372.                       <bold><italic>the-text</italic></bold>
  373.  
  374.                  or, alternately,
  375.  
  376.                       <italic><bold>the-text</bold></italic>
  377.  
  378.                  but,  in  particular,  the  following  is  illegal
  379.                  text/enriched:
  380.  
  381.                       <bold><italic>the-text</bold></italic>
  382.  
  383.             The nesting requirement for formatting  commands  imposes  a
  384.             slightly  higher  burden upon the composers of text/enriched
  385.             bodies, but potentially simplifies text/enriched  displayers
  386.             by  allowing  them  to  be  stack-based.   The  main goal of
  387.             text/enriched is to be  simple  enough  to  make  multifont,
  388.             formatted  email  widely  readable,  so  that those with the
  389.             capability of  sending  it  will  be  able  to  do  so  with
  390.             confidence.   Thus  slightly  increased  complexity  in  the
  391.             composing software was  deemed  a  reasonable  tradeoff  for
  392.             simplified  reading  software.  Nonetheless, implementors of
  393.             text/enriched readers are encouraged to follow  the  general
  394.             Internet  guidelines  of being conservative in what you send
  395.             and liberal in what you accept.  Those implementations  that
  396.             can  do so are encouraged to deal reasonably with improperly
  397.             nested text/enriched data.
  398.  
  399.             Unrecognized formatting commands
  400.  
  401.  
  402.  
  403.  
  404.             Borenstein                                          [Page 7]
  405.  
  406.  
  407.  
  408.  
  409.  
  410.             RFC 1563       A text/enriched type for MIME    January 1994
  411.  
  412.  
  413.             Implementations  must  regard  any  unrecognized  formatting
  414.             command  as "no-op" commands, that is, as commands having no
  415.             effect,   thus    facilitating    future    extensions    to
  416.             "text/enriched".   Private  extensions  may be defined using
  417.             formatting commands that begin  with  "X-",  by  analogy  to
  418.             Internet mail header field names.
  419.  
  420.             In  order  to  formally  define  extended  commands,  a  new
  421.             Internet document should be published.
  422.  
  423.             White Space in Text/enriched Data
  424.  
  425.             No special behavior is required for the SPACE  or  TAB  (HT)
  426.             character.   It is recommended, however, that, at least when
  427.             fixed-width fonts are in use, the common  semantics  of  the
  428.             TAB  (HT) character should be observed, namely that it moves
  429.             to the next column position that is a multiple  of  8.   (In
  430.             other  words,  if  a  TAB (HT) occurs in column n, where the
  431.             leftmost column is column 0, then that TAB  (HT)  should  be
  432.             replaced  by  8-(n mod 8) SPACE characters.)  It should also
  433.             be noted that some mail gateways are  notorious  for  losing
  434.             (or, less commonly, adding) white space at the end of lines,
  435.             so reliance on SPACE or TAB characters at the end of a  line
  436.             is not recommended.
  437.  
  438.             Initial State of a text/enriched interpreter
  439.  
  440.             Text/enriched is assumed to begin  with  filled  text  in  a
  441.             variable-width  font in a normal typeface and a size that is
  442.             average for the current display  and  user.   The  left  and
  443.             right  margins  are  assumed  to be maximal, that is, at the
  444.             leftmost and rightmost acceptable positions.
  445.  
  446.             Non-ASCII character sets
  447.  
  448.             If the character set specified by the charset  parameter  on
  449.             the  Content-type  line  is  anything other than "US-ASCII",
  450.             this means that the text being  described  by  text/enriched
  451.             formatting   commands  is  in  a  non-ASCII  character  set.
  452.             However, the commands themselves are still  the  same  ASCII
  453.             commands that are defined in this document.  This creates an
  454.             ambiguity only with reference  to  the  "<"  character,  the
  455.             octet with numeric value 60.  In single byte character sets,
  456.             such as the ISO-8859 family, this  is  not  a  problem;  the
  457.             octet  60  can  be quoted by including it twice, just as for
  458.             ASCII.  The problem is more  complicated,  however,  in  the
  459.  
  460.  
  461.  
  462.             Borenstein                                          [Page 8]
  463.  
  464.  
  465.  
  466.  
  467.  
  468.             RFC 1563       A text/enriched type for MIME    January 1994
  469.  
  470.  
  471.             case  of multi-byte character sets, where the octet 60 might
  472.             appear at any point in the byte sequence for any of  several
  473.             characters.
  474.  
  475.             In practice, however, most multibyte character sets  address
  476.             this  problem  internally.  For example, the ISO-2022 family
  477.             of character sets can switch back into ASCII at any  moment.
  478.             Therefore   it   is  specified  that,  before  text/enriched
  479.             formatting commands, the prevailing character set should  be
  480.             "switched  back"  into ASCII, and that only those characters
  481.             which would be interpreted as "<" in plain  text  should  be
  482.             interpreted as token delimiters in text/enriched.
  483.  
  484.             The question of what to do for hypothetical future character
  485.             sets  that  do  NOT  subsume  ASCII is not addressed in this
  486.             memo.
  487.  
  488.             Minimal text/enriched conformance
  489.  
  490.             A minimal text/enriched implementation is one that  converts
  491.             "<<"  to  "<",  removes everything between a <param> command
  492.             and the next balancing </param> command, removes  all  other
  493.             formatting  commands  (all text enclosed in angle brackets),
  494.             and, outside of <nofill> environments, converts  any  series
  495.             of n CRLFs to n-1 CRLFs, and converts any lone CRLF pairs to
  496.             SPACE.
  497.  
  498.             Notes for Implementors
  499.  
  500.             It is recognized that implementors of  future  mail  systems
  501.             will  want rich text functionality far beyond that currently
  502.             defined for text/enriched.  The intent of  text/enriched  is
  503.             to provide a common format for expressing that functionality
  504.             in a form in which much of it, at least, will be  understood
  505.             by  interoperating  software.  Thus, in particular, software
  506.             with a richer notion of formatted  text  than  text/enriched
  507.             can still use text/enriched as its basic representation, but
  508.             can extend it with new formatting  commands  and  by  hiding
  509.             information    specific   to   that   software   system   in
  510.             text/enriched <param> constructs.  As such  systems  evolve,
  511.             it  is expected that the definition of text/enriched will be
  512.             further refined  by  future  published  specifications,  but
  513.             text/enriched  as  defined here provides a platform on which
  514.             evolutionary refinements can be based.
  515.  
  516.  
  517.  
  518.  
  519.  
  520.             Borenstein                                          [Page 9]
  521.  
  522.  
  523.  
  524.  
  525.  
  526.             RFC 1563       A text/enriched type for MIME    January 1994
  527.  
  528.  
  529.             An expected common way that sophisticated mail programs will
  530.             generate    text/enriched    data    is   as   part   of   a
  531.             multipart/alternative construct.  For example, a mail  agent
  532.             that  can  generate enriched mail in ODA format can generate
  533.             that mail in a more widely interoperable form by  generating
  534.             both text/enriched and ODA versions of the same data, e.g.:
  535.  
  536.                  Content-type: multipart/alternative; boundary=foo
  537.  
  538.                  --foo
  539.                  Content-type: text/enriched
  540.  
  541.                  [text/enriched version of data]
  542.                  --foo
  543.                  Content-type: application/oda
  544.  
  545.                  [ODA version of data]
  546.                  --foo--
  547.  
  548.             If such a message  is  read  using  a  MIME-conformant  mail
  549.             reader  that  understands  ODA,  the  ODA  version  will  be
  550.             displayed; otherwise,  the  text/enriched  version  will  be
  551.             shown.
  552.  
  553.             In some environments, it  might  be  impossible  to  combine
  554.             certain text/enriched formatting commands, whereas in others
  555.             they might be combined easily.  For example, the combination
  556.             of <bold> and <italic> might produce bold italics on systems
  557.             that support such fonts, but there exist  systems  that  can
  558.             make  text bold or italicized, but not both.  In such cases,
  559.             the most recently issued (innermost)  recognized  formatting
  560.             command should be preferred.
  561.  
  562.             One of the major goals in the design of text/enriched was to
  563.             make it so simple that even text-only mailers will implement
  564.             enriched-to-plain-text  translators,  thus  increasing   the
  565.             likelihood that enriched text will become "safe" to use very
  566.             widely.  To demonstrate this simplicity, an extremely simple
  567.             C  program that converts text/enriched input into plain text
  568.             output is included in Appendix A.
  569.  
  570.             Extensions to text/enriched
  571.  
  572.             It is expected that various mail system authors will  desire
  573.             extensions   to   text/enriched.    The   simple  syntax  of
  574.             text/enriched,  and  the  specification  that   unrecognized
  575.  
  576.  
  577.  
  578.             Borenstein                                         [Page 10]
  579.  
  580.  
  581.  
  582.  
  583.  
  584.             RFC 1563       A text/enriched type for MIME    January 1994
  585.  
  586.  
  587.             formatting  commands should simply be ignored, are intend to
  588.             promote such extensions.
  589.  
  590.             Beyond simply defining new formatting commands, however,  it
  591.             may  sometimes  be  necessary  to define formatting commands
  592.             that can take arguments.  This is the intended  use  of  the
  593.             <param>  construct.   In particular, software that wished to
  594.             extend text/enriched to include colored text might define an
  595.             "x-color"  environment  which always began with a color name
  596.             parameter, to indicate the desired color  for  the  affected
  597.             text.
  598.             An Example
  599.  
  600.             Putting all this  together,  the  following  "text/enriched"
  601.             body fragment:
  602.  
  603.                       From: Nathaniel Borenstein <nsb@bellcore.com>
  604.                       To: Ned Freed <ned@innosoft.com>
  605.                       Content-type: text/enriched
  606.  
  607.                       <bold>Now</bold> is the time for
  608.                       <italic>all</italic> good men
  609.                        <smaller>(and <<women>)</smaller> to
  610.                       <ignoreme>come</ignoreme>
  611.  
  612.                       to the aid of their
  613.  
  614.  
  615.                       <x-color><param>red</param>beloved</x-color>
  616.                       country.
  617.  
  618.                       By the way, I think that <<smaller>
  619.  
  620.                       should
  621.  
  622.                       REALLY be called
  623.  
  624.                       <<tinier>
  625.                       and that I am always right.
  626.  
  627.                       -- the end
  628.  
  629.             represents the following  formatted  text  (which  will,  no
  630.             doubt,  look  somewhat  cryptic  in the text-only version of
  631.             this document):
  632.  
  633.  
  634.  
  635.  
  636.             Borenstein                                         [Page 11]
  637.  
  638.  
  639.  
  640.  
  641.  
  642.             RFC 1563       A text/enriched type for MIME    January 1994
  643.  
  644.  
  645.                  Now is the time for all good men (and <women>)  to
  646.                  come
  647.                  to the aid of their
  648.  
  649.                  beloved country.
  650.                  By the way, I think that <smaller>
  651.                  should
  652.                  REALLY be called
  653.                  <tinier>
  654.                  and that I am always right.
  655.                  -- the end
  656.  
  657.             where the word "beloved" would be in red on a color  display
  658.             if   the   receiving   software  implemented  the  "x-color"
  659.             extension.
  660.  
  661.             Security Considerations
  662.  
  663.             Security issues are not  discussed  in  this  memo,  as  the
  664.             mechanism raises no security issues.
  665.  
  666.             Author's Address
  667.  
  668.             For more information, the author of  this  document  may  be
  669.             contacted via Internet mail:
  670.  
  671.                                 Nathaniel S. Borenstein
  672.                                  MRE 2D-296, Bellcore
  673.                                      445 South St.
  674.                                Morristown, NJ 07962-1910
  675.  
  676.                                 Phone: +1 201 829 4270
  677.                                  Fax:  +1 201 829 5963
  678.                                 Email: nsb@bellcore.com
  679.  
  680.             Acknowledgements
  681.  
  682.             This document  reflects  the  input  of  many  contributors,
  683.             readers,    and    implementors   of   the   original   MIME
  684.             specification,  RFC  1341.   It  also  reflects   particular
  685.             contributions   and   comments   from  Terry  Crowley,  Rhys
  686.             Weatherley, and John LoVerso.
  687.  
  688.             References
  689.  
  690.  
  691.  
  692.  
  693.  
  694.             Borenstein                                         [Page 12]
  695.  
  696.  
  697.  
  698.  
  699.  
  700.             RFC 1563       A text/enriched type for MIME    January 1994
  701.  
  702.  
  703.             [RFC-1341]   Borenstein,   N.,   and   N.   Freed,     "MIME
  704.             (Multipurpose  Internet  Mail  Extensions):   Mechanisms for
  705.             Specifying and Describing the  Format  of  Internet  Message
  706.             Bodies", RFC 1341, Bellcore, Innosoft, June, 1992.
  707.  
  708.             [RFC-1521]   Borenstein,   N.,   and   N.   Freed,     "MIME
  709.             (Multipurpose    Internet   Mail   Extensions)   Part   One:
  710.             Mechanisms for  Specifying  and  Describing  the  Format  of
  711.             Internet  Message  Bodies",  RFC  1521,  Bellcore, Innosoft,
  712.             September, 1993.
  713.  
  714.             Appendix A -- A Simple enriched-to-plain Translator in C
  715.  
  716.             One of the major goals in the design  of  the  text/enriched
  717.             subtype  of  the text Content-Type is to make formatted text
  718.             so  simple  that  even  text-only  mailers  will   implement
  719.             enriched-to-plain-text   translators,  thus  increasing  the
  720.             likelihood that multifont text will  become  "safe"  to  use
  721.             very  widely.   To demonstrate this simplicity, what follows
  722.             is a simple C program that converts text/enriched input into
  723.             plain  text  output.  Note that the local newline convention
  724.             (the single character represented by  "\n")  is  assumed  by
  725.             this  program,  but  that  special  CRLF  handling  might be
  726.             necessary on some systems..
  727.  
  728.                  #include <stdio.h>
  729.                  #include <ctype.h>
  730.  
  731.                  main() {
  732.                      int c, i, paramct=0, newlinect=0, nofill=0;
  733.                      char token[62], *p;
  734.  
  735.                      while ((c=getc(stdin)) != EOF) {
  736.                          if (c == '<') {
  737.                              if (newlinect == 1) putc(' ', stdout);
  738.                              newlinect = 0;
  739.                              c = getc(stdin);
  740.                              if (c == '<') {
  741.                                  if (paramct <= 0) putc(c, stdout);
  742.                              } else {
  743.                                    ungetc(c, stdin);
  744.                                    for (i=0, p=token; (c=getc(stdin)) !=
  745.                  EOF && c != '>'; i++) {
  746.                                        if (i < sizeof(token)-1) *p++ =
  747.                  isupper(c) ? tolower(c) : c;
  748.  
  749.  
  750.  
  751.  
  752.             Borenstein                                         [Page 13]
  753.  
  754.  
  755.  
  756.  
  757.  
  758.             RFC 1563       A text/enriched type for MIME    January 1994
  759.  
  760.  
  761.                                    }
  762.                                    *p = '\0';
  763.                                    if (c == EOF) break;
  764.                                    if (strcmp(token, "param") == 0)
  765.                                        paramct++;
  766.                                    else if (strcmp(token, "nofill") ==
  767.                  0)
  768.                                        nofill++;
  769.                                    else if (strcmp(token, "/param") ==
  770.                  0)
  771.                                        paramct--;
  772.                                    else if (strcmp(token, "/nofill") ==
  773.                  0)
  774.                                        nofill--;
  775.  
  776.                                }
  777.                          } else {
  778.                              if (paramct > 0)
  779.                                  ; /* ignore params */
  780.                              else if (c == '\n' && nofill <= 0) {
  781.                                  if (++newlinect > 1) putc(c, stdout);
  782.                              } else {
  783.                                  if (newlinect == 1) putc(' ', stdout);
  784.                                  newlinect = 0;
  785.                                  putc(c, stdout);
  786.                              }
  787.                          }
  788.                      }
  789.                      /* The following line is only needed with line-
  790.                  buffering */
  791.                      putc('\n', stdout);
  792.                      exit(0);
  793.                  }
  794.  
  795.             It should be noted that one can do considerably better  than
  796.             this  in  displaying  text/enriched data on a dumb terminal.
  797.             In particular, one can  replace  font  information  such  as
  798.             "bold"  with  textual emphasis (like *this* or   _T_H_I_S_).
  799.             One can also properly handle  the  text/enriched  formatting
  800.             commands  regarding  indentation, justification, and others.
  801.             However, the above program is all that is necessary in order
  802.             to  present text/enriched on a dumb terminal without showing
  803.             the user any formatting artifacts.
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.             Borenstein                                         [Page 14]
  811.  
  812.  
  813.  
  814.  
  815.  
  816.             RFC 1563       A text/enriched type for MIME    January 1994
  817.  
  818.  
  819.             Appendix B -- Differences from RFC 1341 text/richtext
  820.  
  821.             Text/enriched  is  a  clarification,   simplification,   and
  822.             refinement of the type defined as text/richtext in RFC 1341.
  823.             For the benefit of  those  who  are  already  familiar  with
  824.             text/richtext,   or  for  those  who  want  to  exploit  the
  825.             similarities to be able to display text/richtext  data  with
  826.             their  text/enriched  software,  the differences between the
  827.             two are summarized here. Note, however,  that  text/enriched
  828.             is  intended  to  make  text/richtext obsolete, so it is not
  829.             recommended that new software generate text/richtext.
  830.  
  831.             0.  The name "richtext" was changed to "enriched",  both  to
  832.             differentiate   the  two  versions  and  because  "richtext"
  833.             created widespread  confusion  with  Microsoft's  Rich  Text
  834.             Format (RTF).
  835.  
  836.             1.   Clarifications.   Many   things   were   ambiguous   or
  837.             unspecified  in  the  text/richtext definition, particularly
  838.             the  initial  state  and  the  semantics  of  richtext  with
  839.             multibyte  character  sets.   However,  such differences are
  840.             OPERATIONALLY irrelevant, since the  clarifications  offered
  841.             in  this document are at least reasonable interpretations of
  842.             the text/richtext specification.
  843.  
  844.             2.  Newline semantics have changed.  In  text/richtext,  all
  845.             CRLFs  were mapped to spaces, and line breaks were indicated
  846.             by "<nl>".  This has been replaced by  the  "n-1"  rule  for
  847.             CRLFs.
  848.  
  849.             3.  The representation of a literal "<" character was "<lt>"
  850.             in text/richtext, but is "<<" in text/enriched.
  851.  
  852.             4.  The "nofill" command did not exist in text/richtext.
  853.  
  854.             5.  The "param" command did not exist in text/richtext.
  855.  
  856.             6.  The following  commands  from  text/richtext  have  been
  857.             REMOVED    from    text/enriched:    <COMMENT>,   <OUTDENT>,
  858.             <OUTDENTRIGHT>,  <SAMEPAGE>,   <SUBSCRIPT>,   <SUPERSCRIPT>,
  859.             <HEADING>,    <FOOTING>,    <ISO-8859-[1-9]>,    <US-ASCII>,
  860.             <PARAGRAPH>, <SIGNATURE>, <NO-OP>, <LT>, <NL>, and <NP>.
  861.  
  862.             7.  All claims of  SGML  compatibility  have  been  dropped.
  863.             However,  with  the possible exceptions of the new semantics
  864.             for CRLF and "<<" can be implemented,  text/enriched  should
  865.  
  866.  
  867.  
  868.             Borenstein                                         [Page 15]
  869.  
  870.  
  871.  
  872.  
  873.  
  874.             RFC 1563       A text/enriched type for MIME    January 1994
  875.  
  876.  
  877.             be no less SGML-friendly than text/richtext was.
  878.  
  879.             8.  In text/richtext, there were three commands (<NL>, <NP>,
  880.             and  <LT>)  that  did  not  use balanced closing delimiters.
  881.             Since all of  these  have  been  eliminated,  there  are  NO
  882.             exceptions to the nesting/balancing rules in text/enriched.
  883.  
  884.             9.  The limit on the size  of  formatting  tokens  has  been
  885.             increased from 40 to 60 characters.
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.             Borenstein                                         [Page 16]
  927.  
  928.  
  929.  
  930.  
  931.  
  932.             RFC 1563       A text/enriched type for MIME    January 1994
  933.  
  934.  
  935.  
  936.  
  937.                                Table of Contents
  938.  
  939.  
  940.             Status of this Memo......................................  1
  941.             Abstract.................................................  1
  942.             The Text/enriched MIME type..............................  1
  943.             Formatting Commands......................................  3
  944.                   Font-Alteration Commands...........................  4
  945.                   Fill/Justification Commands........................  4
  946.                   Indentation Commands...............................  5
  947.                   Miscellaneous Commands.............................  6
  948.                   Balancing and Nesting of Formatting Commands.......  7
  949.                   Unrecognized formatting commands...................  7
  950.             White Space in Text/enriched Data........................  8
  951.             Initial State of a text/enriched interpreter.............  8
  952.             Non-ASCII character sets.................................  8
  953.             Minimal text/enriched conformance........................  9
  954.             Notes for Implementors...................................  9
  955.             Extensions to text/enriched.............................. 10
  956.             An Example............................................... 11
  957.             Security Considerations.................................. 12
  958.             Author's Address......................................... 12
  959.             Acknowledgements......................................... 12
  960.             References............................................... 12
  961.             Appendix A -- A Simple enriched-to-plain Translator in C. 13
  962.             Appendix B -- Differences from RFC 1341 text/richtext.... 15
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.             Borenstein                                         [Page 17]
  985.  
  986.  
  987.